package com.cgc.shop.action;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.cgc.shop.model.User;
@Controller("userAction")
@Scope("prototype")
public class UserAction extends BaseAction<User>{
	public String login() {
		model = userService.getByLoginNameAndPass(model);
		//登陆失败
		if (model == null) {
			sessionMap.put("error", "登陆失败！");
			return "login";
		} else { //登陆成功
			sessionMap.put("user", model);
			System.out.println("urlToGo=" + sessionMap.get("urlToGo"));
			if (sessionMap.get("urlToGo") == null) {
				return "index";
			} else {
				return "goToUrl";
			}
		}
	}
}
